<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let arr = [23,45,56,24]
    // reduce 汇总
    let result = arr.reduce(function(tmp,item,index) {
      return tmp + item
    })
    alert(result)
    console.log(result);
  </script>
</body>
</html>